#!/bin/sh
# search for dsp and save the output with time and group information into text file
# usage: bash dsp.sh m n
# where m is the order of the small group, n is the index of the small group
# see https://gap-packages.github.io/smallgrp/doc/chap0_mj.html#contents for more details.

/home/eric/app/gap/gap-4.12.2/gap -q -o 32g << EOI
LoadPackage("dsp");;
G := SmallGroup($1, $2);;
output := DifferenceSetPairs(G);;
t := StringTime(time);;
len := Length(output);;
f := "$1-$2.txt";;
PrintTo(f, "## Group: [$1, $2]\n## Difference Set Pairs: ", len, "\n## Time: ", t, "\n\n");;
AppendTo(f, "return [\n");;
for i in [1..Length(output)] do
	AppendTo(f, output[i]);;
	if i < Length(output) then AppendTo(f, ",");; fi;;
	AppendTo(f, "\n");;
od;;
AppendTo(f, "];\n\n");;
EOI

